﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EduLogin.aspx.cs" Inherits="EduLogin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
    <title>聚网教学质量监测系统</title>
<link href="Common/css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
 div{_behavior: url("Common/css/iepngfix.htc") }
</style> 
<script type="text/javascript" src="./Common/js/jquery.js"></script>
<script type="text/javascript" src="./Common/js/common.js"></script>
<script type="text/javascript" src="./Common/js/msg.js"></script> 
<script type="text/javascript">


 var schoolMark="<%=schoolMark%>";
 if(window.location != top.location)
 {
        top.location.href = "Default.aspx";
 }
 
 var currWayIndex=1;
 
 
 function SelectLoginWay(wayIndex)
 {
   if(currWayIndex==wayIndex) return;
   for(i=1;i<4;i++)
   {
     document.getElementById("item"+i).className="";
     document.getElementById("Layer"+i).style.display="none";
   }
   ////
    document.getElementById("item"+wayIndex).className="active";
    document.getElementById("Layer"+wayIndex).style.display="";
    currWayIndex=wayIndex;
   ///
    document.getElementById("txtSchoolMark1").value=schoolMark;
    document.getElementById("txtStu_Code").value="";
    document.getElementById("txtStu_Pass").value="";
    ///
    document.getElementById("txtSchoolMark2").value=schoolMark;
    document.getElementById("txtTea_Code").value="";
    document.getElementById("txtTea_Pass").value="";
    ///
    document.getElementById("txtMan_LoginName").value="";
    document.getElementById("txtMan_Pass").value="";
    currWayIndex=wayIndex;
    switch(currWayIndex)
       {
          case 1:
          document.getElementById("txtSchoolMark1").focus();
          break;
           case 2:
           document.getElementById("txtSchoolMark2").focus();
          break;
           case 3:
           document.getElementById("txtMan_LoginName").focus();
          
          break;
       }
    
    
    
 }
 
 //学生登陆
 function StuLogin()
 {
        //alert(1);
        var uid = document.getElementById("txtStu_Code").value.Trim();
        var pwd = document.getElementById("txtStu_Pass").value;
        var txtSchoolMark=document.getElementById("txtSchoolMark1").value;
        if(txtSchoolMark=="")
        {
            showNoticMsg('txtSchoolMark1',"请输入学校编号",-140,20);
            return;
        }
        if(uid=="")
        {
            showNoticMsg('txtStu_Code',"请输入学生学号",-140,20);
            return;
        }
        if(pwd==""){
            showNoticMsg('txtStu_Pass',"请输入学生登陆密码",-140,20);
            return;
        }
       
        PageMethods.StuLogin(txtSchoolMark,uid,pwd,
                function(result){
                
                switch(result)
                {
                 case 3://登陆成功
                    window.location="main.aspx";
                 break;
                 case 2://密码错误
                    showNoticMsg('txtStu_Pass',"密码错误",-140,20);
                 break;
                 case 1://用户名错误
                    showNoticMsg('txtStu_Code',"学号错误",-140,20);
                 break;
                 case 0://学校编号错误
                    showNoticMsg('txtSchoolMark1',"学校编号错误",-140,20);
                 break;
                }
                
                }, 
                function(err) {
                    showMassgeBox(MSG_ERROR_TITLE,err._message);
                    return;
                }
            );          
 
 }
  //教师登陆
  
  function TeaLogin()
  {
  
  //空输入验证
        var uid = document.getElementById("txtTea_Code").value.Trim();
        var pwd = document.getElementById("txtTea_Pass").value;
        var txtSchoolMark=document.getElementById("txtSchoolMark2").value;
        if(txtSchoolMark=="")
        {
            showNoticMsg('txtSchoolMark2',"请输入学校编号",-140,20);
            return;
        }
        if(uid=="")
        {
            showNoticMsg('txtTea_Code',"请输入教师工号",-140,20);
            return;
        }
        if(pwd==""){
            showNoticMsg('txtTea_Pass',"请输入教师登陆密码",-140,20);
            return;
        }
        PageMethods.TeaLogin(txtSchoolMark,uid,pwd,function(result){
        switch(result)
        {
          case 3://登陆成功
             window.location="main.aspx";
          break;
          case 2://密码错误
           showNoticMsg('txtTea_Pass',"教师密码错误",-140,20);
          break;
          case 1://用户名错误
           showNoticMsg('txtTea_Code',"教师工号错误",-140,20);
          break;
           case 0:////学校编号错误
           showNoticMsg('txtSchoolMark2',"学校编号错误",-140,20);
          break;
        }
        },function(err){ showMassgeBox(MSG_ERROR_TITLE,err._message);});
  
  }
  //教育局登陆
  function EducationLogin()
  {
  
  //空输入验证
        var uid = document.getElementById("txtMan_LoginName").value.Trim();
        var pwd = document.getElementById("txtMan_Pass").value;
        //return;
        
        if(uid=="")
        {
            showNoticMsg('txtMan_LoginName',"请输入帐号",-140,20);
            return;
        }
        if(pwd==""){
            showNoticMsg('txtMan_Pass',"请输入登陆密码",-140,20);
            return;
        }
        var schoolArea=document.getElementById("optDw").value;
        PageMethods.EducationLogin(schoolArea,uid,pwd,function(result){
        switch(result)
        {
          case 3://登陆成功
             window.location="main.aspx";
          break;
          case 2://密码错误
           showNoticMsg('txtMan_Pass',Login_PwdError,-140,20);
          break;
          case 1://用户名错误
           showNoticMsg('txtMan_LoginName',Login_UserError,-140,20);
          break;
        }
        },function(err){ showMassgeBox(MSG_ERROR_TITLE,err._message);});
  }
  
  function   enterkey(evt)     
  {   
    evt=evt?evt:window.event;
    if(evt.keyCode==13)   
    {
       switch(currWayIndex)
       {
          case 1:
          StuLogin();
          break;
          
           case 2:
           TeaLogin();
          break;
           case 3:
           EducationLogin();
          break;
       }
    }   
  }     
  /////////////////
  function movefocus(evt,tbName)           
  {    
      evt=evt?evt:window.event;    
      if(evt.keyCode==13)         
      {   
         document.getElementById(tbName).focus();   
      }               
  }
  
</script>
</head>
<body class="loginBody"  onload="SelectLoginWay(<%=loginway %>)">
   <form id="form1" runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">  </asp:ScriptManager>
  <div class="warp">
	<div class="logo">
    	<h1>聚网教学质量监测系统 <sup>２.0</sup></h1>
        <p>evaluation system</p>
    </div>
    
    <ul class="mainNav">
    	<li class="active" id="item1" ><a href="javascript:SelectLoginWay(1)" title="学生" onfocus="this.blur()">学生</a></li>
        <li  id="item2"><a href="javascript:SelectLoginWay(2)"  title="教师" onfocus="this.blur()">教师</a></li>
        <li id="item3"><a href="javascript:SelectLoginWay(3)"   title="教育局/学区" onfocus="this.blur()">教育局/学区</a></li>
    </ul>
    
    <div class="loginForm sdu" id="Layer1">
   			<div class="loginDiv">
            	<label for="">学校编号：</label>
                <input  id="txtSchoolMark1" type="text"  onkeydown="movefocus(event,'txtStu_Code')"   value="<%=schoolMark%>"/> 
            </div>
   			<div class="loginDiv">
            	<label for="">学&nbsp;&nbsp;&nbsp;&nbsp;号：</label>
                <input  id="txtStu_Code" type="text"  onkeydown="movefocus(event,'txtStu_Pass')" /> 
            </div>
            <div class="loginDiv">
            	<label for="">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
                <input id="txtStu_Pass" type="password"  onkeydown="enterkey(event)" />
            </div>
            <div class="loginDiv">&nbsp;&nbsp;&nbsp;&nbsp;<input class="submitBut" name="" value="登录" type="button" onclick="StuLogin()"/></div>
    </div>
    
    
    <div class="loginForm tea" style="display:none" id="Layer2">
   			<div class="loginDiv">
            	<label for="">学校编号：</label>
                <input  id="txtSchoolMark2" type="text"  onkeydown="movefocus(event,'txtTea_Code')"  value="<%=schoolMark%>" /> 
            </div>
   			<div class="loginDiv">
            	<label for="">工&nbsp;&nbsp;&nbsp;&nbsp;号：</label>
                <input  id="txtTea_Code" type="text"  onkeydown="movefocus(event,'txtTea_Pass')" /> 
            </div>
            <div class="loginDiv">
            	<label for="">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
                <input id="txtTea_Pass" type="password"  onkeydown="enterkey(event)" />
            </div>
            <div class="loginDiv">&nbsp;&nbsp;&nbsp;&nbsp;<input class="submitBut" name="" value="登录" type="button" onclick="TeaLogin()"/></div>
    </div>
    
     <div class="loginForm adm" style="display:none" id="Layer3">
     <div class="loginDiv">
            	<label  for="">单&nbsp;&nbsp;&nbsp;&nbsp;位：</label>
                <select  id="optDw" style="width:150px">
                <%=options %>
                </select>
            </div>
   			<div class="loginDiv">
            	<label  for="">帐&nbsp;&nbsp;&nbsp;&nbsp;号：</label>
                <input type="text" id="txtMan_LoginName" onkeydown="movefocus(event,'txtMan_Pass')" /> 
            </div>
            <div class="loginDiv">
            	<label for="">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
                <input id="txtMan_Pass" type="password" onkeydown="enterkey(event)" />
            </div>
            <div class="loginDiv">&nbsp;&nbsp;&nbsp;&nbsp;<input class="submitBut" name="" value="登录" type="button" onclick="EducationLogin()"/></div>
    </div>
    
    <p class="foot"><a href="http://www.juwangtech.com/" title="武汉聚网科技有限公司">武汉聚网科技有限公司</a> 版权所有 @2009 <br />全国免费服务热线：800-713-6688 电子邮箱：service@juwangtech.com</p>
</div>

    </form>
</body>
</html>
